﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using CompilerDLL.LexicalAnalysis;

namespace CompilerPrinciples.LexicalAnalysis
{
    public partial class BaseLexical : Form
    {
        /// <summary>
        /// 词法分析所解析出来单词符号串
        /// </summary>
        protected ArrayList arrayTokens=new ArrayList();


        #region 构造函数

        public BaseLexical()
        {
            InitializeComponent();
           
        }

        #endregion 

        
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
            this.Close();
        }

       

        #region 添加到DataGridView
        protected void AddLexem2DataGridView(ArrayList arrayTokens)
        {
            //添加到DataGridView
            this.dataviewSourceCodeLexem.Rows.Clear();
            for (int i = 0; i < arrayTokens.Count; i++)
            {
                
                ModelTokenType modelTokenType = (ModelTokenType)arrayTokens[i];
                string[] dr ={(i+1).ToString(),modelTokenType.Lexem.ToString(),
                               modelTokenType.TokenType.ToString(),
                               modelTokenType.TokenProperty.ToString()};

                this.dataviewSourceCodeLexem.Rows.Add(dr);
            }

        }
        #endregion

       
     

       
    }
}
